<form method="post">
<input type="hidden" name="method" value="save"/>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
	<tr>
		<td class="th">登录名：</td>
		<td class="td">
			<input class="long" type="text" name="user_id" value="{{$row.user_id}}">
			<input type="hidden" name="id" value="{{$row.id}}">
		</td>
	</tr>
	<tr>
		<td class="th">密码：</td>
		<td class="td">
			<input class="long" type="text" name="password">
		</td>
	</tr>
	<tr>
		<td class="th">确认密码：</td>
		<td class="td">
			<input class="long" type="text" name="password_again">
		</td>
	</tr>
	</tr>
		<tr>
		<td class="th">姓名：</td>
		<td class="td">
			<input class="long" type="text" name="user_name" value="{{$row.user_name}}">
		</td>
	</tr>
	<tr>
		<td class="th">权限：</td>
		<td class="td">
			<select name="grade" class="long">
			<option value="">--选择权限--</option>
			{{html_options options=$permissionGrade selected=$row.grade}}
			</select>
		</td>
	</tr>
	<tr>
		<td><input type="button" value="保存" class="btn" onclick="formCheck()"></td>
	</tr>
</table>
</form>
<script type="text/javascript">
function formCheck()
{
	var flag = true;
	$(".long").each(function(){
		if($(this).val() == ''){
			if($("input[name='id']").val() == ''){
				alert($(this).parent(".td").prev(".th").text()+'不能为空！');
				flag = false;
			}
		}
	});
	
	if($("input[name='password']").val() != $("input[name='password_again']").val()){
		alert("两次输入的密码不一致！");
		return false;
	}
	
	if(flag){
		$("form").submit();
	}else{
		return false;
	}
}
</script>